﻿<UserControl x:Class="Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule.DataReferenceStoreCenterPane"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Converters="clr-namespace:Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <Converters:DeleteEnableConverter x:Key="DeleteEnableConverter1"/>
        <Converters:NegateBoolValueConverter x:Key="Negator"/>
    </UserControl.Resources>
    <Grid>
        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" Background="#FFFFFFFF" BorderBrush="#FFE0E0E0">
            <Grid Margin="0,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="36"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="80"/>
                </Grid.RowDefinitions>
                <Border CornerRadius="5,5,0,0" Grid.Row="1">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFBFBFB" Offset="0"/>
                            <GradientStop Color="#FFF0F0F0" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <StackPanel Orientation="Horizontal">
                        <Button Command="{Binding Path=CreateNewStoreCommand}" Style="{DynamicResource ButtonAddStoreStyle}" Width="26" Height="26" 
                                Content="Button" x:Name="AddStore_Copy" ToolTip="New" Margin="5,0,0,0"
                                AutomationProperties.AutomationId="idCreateNewStore" 
                                IsEnabled="{Binding Converter={StaticResource Negator}, Path=CurrentModel.IsNew}"
                                Visibility="{Binding Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource Self}, Path=IsEnabled}" 
                                />
                        <Button Command="{Binding Path=DeleteStoreCommand}" 
                                Style="{DynamicResource ButtonDelete}" Width="26" Height="26" Content="Button" x:Name="DeleteButton_Copy" 
                                AutomationProperties.AutomationId="idDeleteStore" 
                                ToolTip="Delete" Margin="5,0,0,0"
                                Visibility="{Binding Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource Self}, Path=IsEnabled}" >
                            <Button.IsEnabled>
                                <MultiBinding Converter="{StaticResource DeleteEnableConverter1}">
                                    <Binding Path="CurrentModel.CompleteReferenceStoreModel"/>
                                    <Binding Path="CurrentModel.CanDelete" />
                                    <Binding/>
                                </MultiBinding>
                            </Button.IsEnabled>
                        </Button>
                    </StackPanel>
                </Border>
                <Grid VerticalAlignment="Stretch" Grid.Row="2" Margin="10,10,10,10" Grid.RowSpan="2" AutomationProperties.AutomationId="idMainHost" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" MinHeight="67.104"/>
                            <RowDefinition Height="*"/>
								<RowDefinition Height="60"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.ColumnSpan="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="72"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Image Width="72" HorizontalAlignment="Left" VerticalAlignment="Top"
                                   Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ManagementStudio/headerDataStore.png"/>
                            <TextBlock TextAlignment="Justify" Text="Data store is an connection to the data reference provider using which trident saves large data to the data provider. Data stores are created using the parameter configuration UI provided by the data provider." 
                                       TextWrapping="Wrap" Margin="10,0,0,0" Grid.Column="1" VerticalAlignment="Top" />
                        </Grid>
                        <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="1" Grid.RowSpan="1" AutomationProperties.AutomationId="idMainHostScrollViewer" 
                             HorizontalScrollBarVisibility="Auto"     Visibility="{Binding Converter={StaticResource BooleanToVisibilityConverter}, Path=CurrentModel.CompleteReferenceStoreModel}" >
                            <StackPanel Margin="0,0,0,0" >
                                <Border CornerRadius="5,5,5,5" BorderThickness="0,0,0,0" BorderBrush="#FFC4C4C4" Background="#FFFFFFFF" Margin="60,15,10,10">
                                    <Grid Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="125"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" MinHeight="20.2"/>
                                            <RowDefinition Height="Auto" MinHeight="19.04"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <!--ID-->
                                        <TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Text="ID:" Grid.Row="0" TextWrapping="Wrap" Margin="0,5,5,0"/>
                                        <TextBox Text="{Binding Path=CurrentModel.DisplayId}" AutomationProperties.AutomationId="Id" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True" 
                                                 ToolTipOpening="TextBox_ToolTipOpening"
                                                 TextWrapping="NoWrap" Grid.Column="1" Grid.Row="0" Width="250" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" IsEnabled="False"/>
                                        <!--Name-->
                                        <Grid VerticalAlignment="Top" Grid.Row="1" Margin="0,5,8,0" HorizontalAlignment="Right">
                                            <Grid Margin="0,-0.5,-7.5,0" Width="8" Height="8" HorizontalAlignment="Right" VerticalAlignment="Top">
                                            <Path RenderTransformOrigin="0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Fill="#FFFF0000" Stretch="Fill" StrokeThickness="0" Data="M18.597656,17.335052 L25.59375,17.335052 L25.382813,29.253021 L36.210938,22.010834 L39.832031,27.424896 L27.667969,34.561615 L39.832031,41.768646 L36.210938,47.112396 L25.242188,39.624115 L25.628906,51.85849 L18.597656,51.85849 L18.808594,39.975677 L8.0859375,47.147552 L4.5,41.73349 L16.59375,34.596771 L4.5703125,27.38974 L8.0859375,21.975677 L18.808594,29.253021 z">
                                                <Path.RenderTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
                                                        <SkewTransform AngleX="0" AngleY="0"/>
                                                        <RotateTransform Angle="0"/>
                                                        <TranslateTransform X="0" Y="0"/>
                                                    </TransformGroup>
                                                </Path.RenderTransform>
                                            </Path>
                                        </Grid>
                                            <TextBlock Margin="-2,0,0,0" AutomationProperties.AutomationId="idName" HorizontalAlignment="Right" Text="Name:" TextWrapping="Wrap"/>
                                        </Grid>
                                        <TextBox Text="{Binding Path=CurrentModel.Name}" AutomationProperties.AutomationId="Name" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                                 ToolTipOpening="TextBox_ToolTipOpening"
                                                 HorizontalAlignment="Left" Width="250" TextWrapping="NoWrap" Margin="0,5,0,0" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" IsEnabled="True" MaxLength="75"/>                                    
                                        
                                        <!--Description-->
                                        <TextBlock HorizontalAlignment="Right" Text="Description:" TextWrapping="Wrap" Grid.Row="2" Margin="0,5,5,0" VerticalAlignment="Top"/>
                                        <TextBox Text="{Binding Path=CurrentModel.Description}" AutomationProperties.AutomationId="Description" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True" Height="60"
                                                 ToolTipOpening="TextBox_ToolTipOpening"
                                                 TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="2" VerticalScrollBarVisibility="Auto" Grid.RowSpan="1" IsEnabled="True" MaxLength="300"/>
                                        <!--Parameters-->
                                        <Grid VerticalAlignment="Top" Grid.Row="3" Margin="0,5,8,0" HorizontalAlignment="Right">
                                            <Grid Margin="0,-0.5,-7.5,0" Width="8" Height="8" HorizontalAlignment="Right" VerticalAlignment="Top">
                                                <Path RenderTransformOrigin="0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Fill="#FFFF0000" Stretch="Fill" StrokeThickness="0" Data="M18.597656,17.335052 L25.59375,17.335052 L25.382813,29.253021 L36.210938,22.010834 L39.832031,27.424896 L27.667969,34.561615 L39.832031,41.768646 L36.210938,47.112396 L25.242188,39.624115 L25.628906,51.85849 L18.597656,51.85849 L18.808594,39.975677 L8.0859375,47.147552 L4.5,41.73349 L16.59375,34.596771 L4.5703125,27.38974 L8.0859375,21.975677 L18.808594,29.253021 z">
                                                    <Path.RenderTransform>
                                                        <TransformGroup>
                                                            <ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
                                                            <SkewTransform AngleX="0" AngleY="0"/>
                                                            <RotateTransform Angle="0"/>
                                                            <TranslateTransform X="0" Y="0"/>
                                                        </TransformGroup>
                                                    </Path.RenderTransform>
                                                </Path>
                                            </Grid>
                                            <TextBlock Margin="-2,0,0,0" AutomationProperties.AutomationId="idParameters" HorizontalAlignment="Right" Text="Parameters:" TextWrapping="Wrap"/>
                                        </Grid>
									    <TextBox Text="{Binding Path=CurrentModel.Parameters}" AutomationProperties.AutomationId="Parameters" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True" Height="100"
                                                 ToolTipOpening="TextBox_ToolTipOpening"
                                                 TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="3" VerticalScrollBarVisibility="Auto" Grid.RowSpan="1" IsReadOnly="True"/>
                                    </Grid>
                                </Border>
                            </StackPanel>
                        </ScrollViewer>

                    <Border BorderBrush="#FFC1C1C1" BorderThickness="0,1,0,0" Padding="0,10,0,0"  Grid.Row="2">
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AutomationProperties.AutomationId="idGridSave" >
                            <Button HorizontalAlignment="Right" VerticalAlignment="Top"  Width="130" AutomationProperties.AutomationId="idConfigureParameters" Content="Configure parameters" Command="{Binding Path=ConfigureParametersCommand}" Margin="0,0,191,0"/>
                            <Button HorizontalAlignment="Right" VerticalAlignment="Top" Width="70" AutomationProperties.AutomationId="idSave" Content="Save" Command="{Binding Path=SaveChangesCommand}" Margin="0,0,101,0"/>
                            <Button HorizontalAlignment="Right" VerticalAlignment="Top" Width="70" AutomationProperties.AutomationId="idCancel" Content="Cancel" Margin="0,0,11.25,0" Command="{Binding Path=CancelChangesCommand}" />
                        </Grid>
                    </Border>
                </Grid>
                <Border Margin="0,0,0,0" CornerRadius="5,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#FFFFFFFF">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <TextBlock Text="Data Store" TextWrapping="Wrap" FontSize="14" FontWeight="Normal" Margin="7,2,0,0"/>
                </Border>
            </Grid>
        </Border>
    </Grid>
</UserControl>
